//
//  UIAlertController+ZLFaster.m
//  BaseProject
//
//  Created by itzhaolei on 2024/7/12.
//

#import "UIAlertController+ZLFaster.h"

@implementation UIAlertController(ZLFaster)

/**弹窗
 *@param delegate 代理
 *@param string 内容信息
 *@param complete 点击确定后的事件
 */
+ (void)presentViewControllerWithDelegate:(UIViewController *)delegate message:(NSString *)string results:(void (^)(BOOL cancel))complete {
    UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"提示" message:string preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) {
        complete(YES);
    }];
    [alert addAction:defaultAction];
    UIAlertAction* defaultAction1 = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
        complete(NO);
    }];
    [alert addAction:defaultAction1];
    [delegate presentViewController:alert animated:YES completion:nil];
}

@end
